home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 061-070 / amok62 / sorting / sorting.hlp < prev    next >
Encoding:
Text File  |  1993-11-04  |  1.9 KB  |  52 lines

  1. ç
  2. TYPE
  3.   ªSwapProcedureª=PROCEDURE (LONGINT,LONGINT);
  4. (*
  5.  * FUNCTION     swap two elements of an array
  6.  *              Swaps two elements of an array.
  7.  * INPUTS       LONGINT = index of an element in the array
  8.  *              LONGINT = index of an element in the array
  9.  *
  10.  *)
  11. ç
  12. ç
  13. TYPE
  14.   ªComparisonª=PROCEDURE (LONGINT,LONGINT) : BOOLEAN;
  15. (*
  16.  * FUNCTION     compare two elements
  17.  *              Compares two elements of an array.
  18.  * INPUTS       LONGINT = index of an element in the array
  19.  *              LONGINT = index of an element in the array
  20.  * RESULTS      TRUE if the comparison is TRUE else FALSE
  21.  *
  22.  *)
  23. ç
  24. ç
  25. PROCEDURE ªQuickSortª (first,last : LONGINT;
  26.                      Lower      : ºComparisonº;
  27.                      Swap       : ºSwapProcedureº;
  28.                      ascending  : BOOLEAN);
  29. (*
  30.  * FUNCTION     sort an array
  31.  *              This implementation of the quicksort-algorythm is very
  32.  *              flexible. It sorts arrays of every type and the user can
  33.  *              choose if the array is sorted ascending or not. To make this
  34.  *              possible the user has to write two procedures. One that
  35.  *              compares two elements of the array and one that swaps two
  36.  *              elements.
  37.  * INPUTS       first = first index of the array
  38.  *              last = last index of the array
  39.  *              Lower = PROCEDURE which compares two elements of the array
  40.  *                      returns TRUE if the first element of the comparison
  41.  *                      is really lower (a<b) than the second element
  42.  *              Swap = PROCEDURE which swaps two elements of the array
  43.  *              ascending = if ascending is TRUE the first element of the
  44.  *                          array will be the smallest and the last element
  45.  *                          the greatest
  46.  *                          if ascending is FALSE it will be vice versa
  47.  * BUGS         none known
  48.  * AUTHOR       Markus Uhlendahl
  49.  *
  50.  *)
  51. ç
  52.